Try to fix #315732, reported by Luke Hutchinson:
authorMatthias Clasen <mclasen@redhat.com>
Tue, 2 Jan 2007 19:07:03 +0000 (19:07 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Tue, 2 Jan 2007 19:07:03 +0000 (19:07 +0000)
2007-01-02  Matthias Clasen  <mclasen@redhat.com>

        Try to fix #315732, reported by Luke Hutchinson:

        * gdk/x11/xsettings-client.[hc]:
        * gdk/x11/gdkdevents-x11.c: Don't assume that ref'ing a GdkWindow
        will guarantee that it can be looked up in the xid hash later.
        Also, use the nesting server grab function during the xsettings
        client initialization. Finally, make xsettings client not
        eat DestroyNotifys so that GDK can do its regular cleanup.

svn path=/trunk/; revision=17022

ChangeLog
gdk/x11/gdkevents-x11.c
gdk/x11/xsettings-client.c
gdk/x11/xsettings-client.h

index 81660e8756d63fef1831b7d925440a7856f5eb03..ef1b7988b04217c1670c0823d4149125fec63026 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2007-01-02  Matthias Clasen  <mclasen@redhat.com>
+
+       Try to fix #315732, reported by Luke Hutchinson:
+
+       * gdk/x11/xsettings-client.[hc]:
+       * gdk/x11/gdkdevents-x11.c: Don't assume that ref'ing a GdkWindow
+       will guarantee that it can be looked up in the xid hash later.
+       Also, use the nesting server grab function during the xsettings
+       client initialization. Finally, make xsettings client not
+       eat DestroyNotifys so that GDK can do its regular cleanup. 
+
 2007-01-02  Michael Natterer  <mitch@imendio.com>
 
        * gtk/gtkrange.c (gtk_range_scroll) (gtk_range_move_slider): beep
index 58efcdd897be22936b480fba9368b6af42dd75a0..83b45789a39beee575fc8dfa65307c5805f982f3 100644 (file)
@@ -18,7 +18,7 @@
  */
 
 /*
- * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
+ * Modified by the GTK+ Team and others 1997-2007.  See the AUTHORS
  * file for a list of people on the GTK+ Team.  See the ChangeLog
  * files for a list of changes.  These files are distributed with
  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
@@ -177,15 +177,13 @@ _gdk_x11_events_init_screen (GdkScreen *screen)
   /* Keep a flag to avoid extra notifies that we don't need
    */
   screen_x11->xsettings_in_init = TRUE;
-  screen_x11->xsettings_client = xsettings_client_new (screen_x11->xdisplay,
-                                                      screen_x11->screen_num,
-                                                      gdk_xsettings_notify_cb,
-                                                      gdk_xsettings_watch_cb,
-                                                      screen);
-  xsettings_client_set_grab_func (screen_x11->xsettings_client,
-                                 refcounted_grab_server);
-  xsettings_client_set_ungrab_func (screen_x11->xsettings_client,
-                                   refcounted_ungrab_server);
+  screen_x11->xsettings_client = xsettings_client_new_with_grab_funcs (screen_x11->xdisplay,
+                                                                      screen_x11->screen_num,
+                                                                      gdk_xsettings_notify_cb,
+                                                                      gdk_xsettings_watch_cb,
+                                                                      screen,
+                                                                       refcounted_grab_server,
+                                                                       refcounted_ungrab_server);
   screen_x11->xsettings_in_init = FALSE;
 }
 
@@ -3008,16 +3006,13 @@ gdk_xsettings_watch_cb (Window   window,
     {
       if (!gdkwin)
        gdkwin = gdk_window_foreign_new_for_display (gdk_screen_get_display (screen), window);
-      else
-       g_object_ref (gdkwin);
       
       gdk_window_add_filter (gdkwin, gdk_xsettings_client_event_filter, screen);
     }
   else
     {
-      g_assert (gdkwin);
-      gdk_window_remove_filter (gdkwin, gdk_xsettings_client_event_filter, screen);
-      g_object_unref (gdkwin);
+      if (gdkwin)
+        gdk_window_remove_filter (gdkwin, gdk_xsettings_client_event_filter, screen);
     }
 }
 
index d0ae1ec885a8c0fe1507c00460551f1fdd84e55d..d17e4213a6c2e5e60f54ccde5a8cae5b7483dc9d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2001 Red Hat, Inc.
+ * Copyright © 2001, 2007 Red Hat, Inc.
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -454,6 +454,19 @@ xsettings_client_new (Display             *display,
                      XSettingsNotifyFunc  notify,
                      XSettingsWatchFunc   watch,
                      void                *cb_data)
+{
+  return xsettings_client_new_with_grab_funcs (display, screen, notify, watch, cb_data,
+                                               NULL, NULL);
+}
+
+XSettingsClient *
+xsettings_client_new_with_grab_funcs (Display             *display,
+                                     int                  screen,
+                                     XSettingsNotifyFunc  notify,
+                                     XSettingsWatchFunc   watch,
+                                     void                *cb_data,
+                                     XSettingsGrabFunc    grab,
+                                     XSettingsGrabFunc    ungrab)
 {
   XSettingsClient *client;
   char buffer[256];
@@ -469,8 +482,8 @@ xsettings_client_new (Display             *display,
   client->notify = notify;
   client->watch = watch;
   client->cb_data = cb_data;
-  client->grab = NULL;
-  client->ungrab = NULL;
+  client->grab = grab;
+  client->ungrab = ungrab;
   
   client->manager_window = None;
   client->settings = NULL;
@@ -505,6 +518,7 @@ xsettings_client_new (Display             *display,
   return client;
 }
 
+
 void
 xsettings_client_set_grab_func   (XSettingsClient      *client,
                                  XSettingsGrabFunc     grab)
@@ -571,7 +585,8 @@ xsettings_client_process_event (XSettingsClient *client,
       if (xev->xany.type == DestroyNotify)
        {
          check_manager_window (client);
-         return True;
+          /* let GDK do its cleanup */
+         return False; 
        }
       else if (xev->xany.type == PropertyNotify)
        {
index b916eba1e062e83e2f31f8c2121827576d840348..ba34130107aa75159efb57a964188172175db152 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2001 Red Hat, Inc.
+ * Copyright © 2001, 2007 Red Hat, Inc.
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -54,6 +54,13 @@ XSettingsClient *xsettings_client_new             (Display             *display,
                                                   XSettingsNotifyFunc  notify,
                                                   XSettingsWatchFunc   watch,
                                                   void                *cb_data);
+XSettingsClient *xsettings_client_new_with_grab_funcs (Display             *display,
+                                                      int                  screen,
+                                                      XSettingsNotifyFunc  notify,
+                                                      XSettingsWatchFunc   watch,
+                                                      void                *cb_data,
+                                                       XSettingsGrabFunc    grab,
+                                                       XSettingsGrabFunc    ungrab);
 void             xsettings_client_set_grab_func   (XSettingsClient     *client,
                                                   XSettingsGrabFunc    grab);
 void             xsettings_client_set_ungrab_func (XSettingsClient     *client,